<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCourseSectionQuestionAnswersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
       //章节问答
        Schema::create('course_section_question_answers', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('course_id')->comment("课程id");
            $table->unsignedInteger('course_section_id')->comment("章节id");
            $table->unsignedInteger('users_id')->comment("用户id")->nullable();
            $table->text('body')->default('')->comment('问答内容');
            $table->unsignedInteger('praise')->default(0)->comment("点赞数量")->nullable();
            $table->unsignedInteger('pv')->default(0)->comment("浏览量")->nullable();
            $table->unsignedInteger('answer_num')->default(0)->comment("浏览量")->nullable();
            $table->tinyInteger("adopt")->default(0)->comment("是否有采纳[否,是]");

            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('course_section_question_answers');
    }
}
